package com.copm.ifm.servers.sys.service.impl.type;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.copm.ifm.base.basic.constant.DbConstants;
import com.copm.ifm.base.basic.pojo.vo.BaseTreeVO;
import com.copm.ifm.base.service.tree.TreeHandler;
import com.copm.ifm.servers.sys.entity.SysDefaultType;
import com.copm.ifm.servers.sys.mapper.type.SysDefaultTypeMapper;
import com.copm.ifm.servers.sys.service.type.SysDefaultTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统默认分类 服务实现类
 *
 * @author zzf
 * @since 2020-12-14
 */
@Service
public class SysDefaultTypeServiceImpl extends ServiceImpl<SysDefaultTypeMapper, SysDefaultType> implements SysDefaultTypeService {

    @Override
    public BaseTreeVO getTree(Integer type) {
        List<SysDefaultType> defaultTypeList = baseMapper.selectList(new LambdaQueryWrapper<SysDefaultType>()
                .eq(SysDefaultType::getType, type)
                .eq(SysDefaultType::getDeleted, DbConstants.DEFAULT_NO)
        );
        return TreeHandler.defaultInstance().getTree(defaultTypeList);
    }
}
